//
//  MVTableViewCell.m
//  QQMusic_MV
//
//  Created by dllo on 16/8/15.
//  Copyright © 2016年 yh. All rights reserved.
//

#import "MVTableViewCell.h"
#define kMVCollectionView @"collectReuse"
#import "MVCollectionViewCell.h"
#import "MvlistModel.h"

@interface MVTableViewCell () <UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout>
@property (strong, nonatomic) IBOutlet UICollectionView *MVCollectionView;

@end


@implementation MVTableViewCell
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.row == 0) {
        NSLog(@"%@", NSStringFromCGRect(self.bounds));
        return CGSizeMake(CGRectGetWidth(collectionView.bounds), CGRectGetHeight(collectionView.bounds) / 2 - 20);
    } else {
        return CGSizeMake((CGRectGetWidth(collectionView.bounds) - 10) / 2, CGRectGetHeight(collectionView.bounds) / 4);
    }
}
// 刷新数据
- (void)setMvListArray:(NSArray<MvlistModel *> *)mvListArray {
    _mvListArray = mvListArray;
    [_MVCollectionView reloadData];
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    return self.mvListArray.count;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    MVCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kMVCollectionView forIndexPath:indexPath];
    
    cell.mvlist = _mvListArray[indexPath.row];
    
    
    return cell;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
